<?php

/**
 * 留言板
 */
class FeedbackAR extends CActiveRecord { 
	public static function model($className=__CLASS__){
		return parent::model($className);
	}

	public function tableName(){
		return self::tblName();
	}
	
	public static function tblName(){
		return 'ccs8_feedback';
	}
	
	public static function queryPage($pageno = 1){
		$pagesize = Yii::app()->params['feedbackPageSize'];
		$page = new Page($pageno,$pagesize);
		
		$sql = 'select count(*) from '.self::tblName();
		$totalrecord = DBUtil::queryScalar($sql);
		$page->totalrecord = $totalrecord;
		
		$sql = 'select user_name,content,admin_reply,ctime from '.self::tblName();
		$sql .= ' order by feedback_id desc'.$page->LimitStr();
		$recordlist = DBUtil::queryAll($sql);
		$page->recordlist = $recordlist;
		
		return $page;
	}

}